/*! \file profile_section.cpp
 *	\brief 
 *
 *	created:	2009/11/20
 *	created:	20:11:2009   18:27
 *	filename: 	o:\main\libs\mem\profile_section.cpp
 *	file path:	o:\main\libs\mem
 *	file base:	profile_section
 *	file ext:	cpp
 *	author:		Vitalii Trubchaninov
 *				venngraydog@gmail.com
 */
 
#include "mem/stdafx.h"
#include "mem/profile_section.h"

#include "mem/impl/provider.h"

#if TT_MEM_ENABLED && TT_MEM_PROFILING

namespace tt{
namespace mem{

namespace starters{

void Normal::section_start(const char* section_name, impl::BlockInfo*& section, impl::BlockInfo*& previous)
{
	impl::g_provider().section_start(section_name, section, previous);
}

void ToRoot::section_start(const char* section_name, impl::BlockInfo*& section, impl::BlockInfo*& previous)
{
	impl::g_provider().section_start_to_root(section_name, section, previous);
}

} //namespace section_creation


//////////////////////////////////////////////////////////////////////////
template<class SectionCreation>
ProfileSection<SectionCreation>::ProfileSection(const char* section_name)
{
	SectionCreation::section_start(section_name, m_section, m_previous);
}

template<class SectionCreation>
ProfileSection<SectionCreation>::~ProfileSection()
{
	impl::g_provider().section_end(m_section, m_previous);
}

template class ProfileSection<starters::Normal>;
template class ProfileSection<starters::ToRoot>;

} //mem
} //namespace tt

#endif //TT_MEM_ENABLED && TT_MEM_PROFILING
